<template>
  <tbody>
    <tr v-for="(item, index) in goodList" :key="index">
      <td>
        <input
          type="checkbox"
          :checked="item.checked"
          @change="$emit('change-status-event', index)"
        />
      </td>
      <td>{{ item.name }}</td>
      <td>{{ item.price }}</td>
      <td>
        <button @click="$emit('reduce', index)">-</button>
        {{ item.num }}
        <button @click="$emit('add', index)">+</button>
      </td>
      <td>{{ item.price * item.num }}</td>
      <td><button @click="$emit('del-event', index)">删除</button></td>
    </tr>
  </tbody>
</template>

<script>
export default {
  props: {
    goodList: {
      type: Array,
      required: true,
    },
  },
  data() {
    return {};
  },
};
</script>

<style scoped></style>